<!-- Home -->
{{- if eq .Kind "home" -}}
    {{- $title := .Title | default .Site.Title -}}
    {{- .Scratch.Set "rawTitle" $title -}}
    {{- .Scratch.Set "title" $title -}}
<!-- Taxonomy -->
{{- else if eq .Kind "taxonomyTerm" -}}
    {{- $rawTitle := (.Title | default (.Type | title)) -}}
    {{- $title := printf "%s | %s" $rawTitle .Site.Title -}}
    {{- .Scratch.Set "rawTitle" $rawTitle -}}
    {{- .Scratch.Set "title" $title -}}
<!-- Taxonomy Term -->
{{- else if eq .Kind "taxonomy" -}}
    {{- $taxonomyTermTitle := .Title | default .Data.Term | default (delimit (last 1 (split (strings.TrimSuffix "/_index.md" .Path) "/")) " ") -}}
    {{- with .Site.GetPage (printf "/%s" .Data.Plural) -}}
        {{- $rawTitle := printf "%s: %s" (.Title | default (.Type | title)) $taxonomyTermTitle -}}
        {{- $title := printf "%s | %s" $rawTitle .Site.Title -}}
        {{- $.Scratch.Set "rawTitle" $rawTitle -}}
        {{- $.Scratch.Set "title" $title -}}
    {{- end -}}
<!-- Section -->
{{- else if eq .Kind "section" -}}
    {{- $rawTitle := .Title | default (delimit (last 1 (split (strings.TrimSuffix "/_index.md" .Path) "/")) " ") | plainify -}}
    {{- $title := printf "%s | %s" $rawTitle .Site.Title -}}
    {{- .Scratch.Set "rawTitle" $rawTitle -}}
    {{- .Scratch.Set "title" $title -}}
<!-- Page -->
{{- else -}}
    {{- $rawTitle := .Title | plainify -}}
    {{- $title := printf "%s | %s" $rawTitle .Site.Title -}}
    {{- .Scratch.Set "rawTitle" $rawTitle -}}
    {{- .Scratch.Set "title" $title -}}
{{- end -}}